/*
 * Copyright (c) 2014 laidian. All Rights Reserved.
 * @author yaoyuming
 * @date  2020-03-24 17:43
 */
package com.yao.common.enums.business.sys;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 性别枚举
 * @author yaoyuming
 * @date 2020/03/24 17:43
 */
@Getter
public enum SexEnum {
    FEMALE(1, "女"),
    MALE(2, "男");

    @EnumValue
    private final int code;
    private final String desc;

    SexEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private static Map<Integer, String> enums = Stream.of(SexEnum.values()).collect(Collectors.toMap(SexEnum::getCode, SexEnum::getDesc));

    public static String getDesc(int code){
        return enums.get(code);
    }

}
